Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-spreadsheet

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-spreadsheet

Google Sheets API (v4) -- simple interface to read/write data and manage sheets

  • 3.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
213K
decreased by-5.02%
Maintainers
1
Weekly downloads
 
Created

What is google-spreadsheet?

The google-spreadsheet npm package allows you to interact with Google Sheets through the Google Sheets API. It provides a simple and intuitive way to read, write, and manage Google Sheets data programmatically.

What are google-spreadsheet's main functionalities?

Authentication

This feature allows you to authenticate with the Google Sheets API using either service account credentials or OAuth2 tokens.

const { GoogleSpreadsheet } = require('google-spreadsheet');
const doc = new GoogleSpreadsheet('<spreadsheet-id>');

// Using service account credentials
await doc.useServiceAccountAuth(require('./path/to/credentials.json'));

// OR using OAuth2 tokens
await doc.useOAuth2Client(oAuth2Client);

Loading a Spreadsheet

This feature allows you to load the spreadsheet's metadata and worksheets, making it possible to interact with the spreadsheet's structure and data.

await doc.loadInfo(); // loads document properties and worksheets
console.log(doc.title);

Reading Rows

This feature allows you to read rows from a specific sheet within the spreadsheet. You can access individual cell values and iterate through the rows.

const sheet = doc.sheetsByIndex[0]; // or use doc.sheetsById[id]
const rows = await sheet.getRows(); // can pass in { limit, offset }
console.log(rows[0].name);

Adding Rows

This feature allows you to add new rows to a sheet within the spreadsheet. You can specify the values for each column in the new row.

await sheet.addRow({ name: 'John Doe', email: 'john.doe@example.com' });

Updating Cells

This feature allows you to update the values of specific cells in a row and save the changes back to the spreadsheet.

const row = rows[0];
row.name = 'Jane Doe';
await row.save();

Other packages similar to google-spreadsheet

Keywords

FAQs

Package last updated on 14 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc